<extend name="Public/base" />
<block name="content">
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a href="{:U('Index/index')}" title="首页" class="tip-bottom"><i class="icon-home"></i> 首页</a> 
			<a href="#" class="current">{$meta_title}</a>
		</div>
	</div>
	<div class="container-fluid">
		<br/>
		<div class="search-form fl cf">
			<div class="sleft">
				<form autocomplete="off">
					<span class="control-group">
			      		<input type="text" name="start_time" readonly class="datepicker" value="{:strip_tags(I('start_time'))}" placeholder="开始时间" style="width:120px; text-align:center;" >
			      		<input type="text" name="end_time" readonly class="datepicker" value="{:strip_tags(I('end_time'))}" placeholder="结束时间" style="width:120px; text-align:center;" >
					</span>
					<button class="btn btn-primary" type="button" onclick="$('form').submit()" id="search_count"><i class="icon-search icon-white"></i></button>　<img id="loading" style="display:none;" src="__IMG__/loading.gif">
					<div class="control" id="member_list" style="margin:20px 0 5px 0;"></div>
				</form>
			</div>
		</div>
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div class="widget-content ">
						<table id="count_table" style="display:none;" class="table table-bordered table-striped">
							<thead>
								<tr>
									<th>通话次数</th>
									<th>接通量</th>
									<th>有效通话率</th>
								</tr>
							</thead>
							<tbody id="count_content"></tbody>
						</table>
						<center id="null_table">暂无数据</center>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
$(function (){
	//员工加载
    $.ajax({ url: "{:U('ServiceStatistics/getMemberList')}", success: function(data){
    	if('' != data){
	        $('#member_list').html(data).hide().fadeIn(300);
	        //初始化控件
	        var IS_INIT = 1;
	     	// 全选
	        $(".checkbox-all").bind("click",function(){
	            $(this).nextAll("div.checkbox-group").children("label").children("input").prop("checked", true);
	        });
	        // 反选
	        $(".checkbox-opposite").bind("click",function(){
	            $(this).nextAll("div.checkbox-group").children("label").children("input[type=checkbox]").each(function(e) {
	                if ($(this).is(":checked")) {
	                    $(this).prop("checked", false);
	                }else{
	                    $(this).prop("checked", true);
	                }
	            });
	        });
    	}
	}});
    //统计
	$('form').submit(function(){
		$('#search_count').prop('disabled', true);
		$('#loading').show();
		$.post("{:U('ServiceStatistics/call')}", $('form').serialize(), call_back, "json");
		return false;
		function call_back(data){
			if(data.status == 1){
				var html_str = '<tr>' +
					'<td class="taskStatus">' + data.info.call_count + '</td>' +
					'<td class="taskStatus">' + data.info.valid_count + '</td>' +
					'<td class="taskStatus">' + data.info.call_percent + '</td>' +
					'</tr>';
				$('#null_table').hide();
				$('#count_table').fadeIn(300);
				$('#count_content').html(html_str);
			}else{
				tke_alert(data.info, 'alert-error', 2000);
				$('#count_table').hide();
				$('#null_table').show();
				$('#count_content').html('');
			}
			setTimeout(function(){
				$('#loading').hide();
				$('#search_count').prop('disabled', false);
			}, 1000);
		}
	});
	//日期控件
	$(".datepicker").datetimepicker({
		format: 'yyyy-mm-dd',
		startDate: '2015-07-01',
		minView: 'month',
	    autoclose: true,
	    todayBtn: true
	});
});
//导航高亮
highlight_subnav("{:U('ServiceStatistics/call')}");
</script>
</block>